home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / csD POP Cl24201862001.psc / frmEmailSetup.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-08-07  |  11.7 KB  |  389 lines

  1. VERSION 5.00
  2. Begin VB.Form frmEmailSetup 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    ClientHeight    =   5295
  6.    ClientLeft      =   45
  7.    ClientTop       =   45
  8.    ClientWidth     =   5775
  9.    ControlBox      =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    Picture         =   "frmEmailSetup.frx":0000
  14.    ScaleHeight     =   5295
  15.    ScaleWidth      =   5775
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   3  'Windows Default
  18.    Begin VB.TextBox txtDomain 
  19.       BackColor       =   &H00FFC0C0&
  20.       Height          =   285
  21.       Left            =   3240
  22.       TabIndex        =   17
  23.       Top             =   1200
  24.       Width           =   2055
  25.    End
  26.    Begin VB.CheckBox chkSavePAssword 
  27.       BackColor       =   &H00800000&
  28.       Caption         =   "Check1"
  29.       Height          =   255
  30.       Left            =   3000
  31.       TabIndex        =   14
  32.       Top             =   1560
  33.       Value           =   1  'Checked
  34.       Width           =   255
  35.    End
  36.    Begin VB.CommandButton cmdAddPOP 
  37.       BackColor       =   &H00800000&
  38.       Caption         =   "+"
  39.       Height          =   255
  40.       Left            =   5400
  41.       MaskColor       =   &H00C00000&
  42.       TabIndex        =   13
  43.       Top             =   480
  44.       Width           =   255
  45.    End
  46.    Begin VB.CommandButton cmdAddSMTP 
  47.       BackColor       =   &H00800000&
  48.       Caption         =   "+"
  49.       Height          =   255
  50.       Left            =   5400
  51.       MaskColor       =   &H00C00000&
  52.       TabIndex        =   12
  53.       Top             =   840
  54.       Width           =   255
  55.    End
  56.    Begin VB.ComboBox cmbSMTP 
  57.       BackColor       =   &H00FFC0C0&
  58.       Height          =   315
  59.       Left            =   1200
  60.       TabIndex        =   11
  61.       Text            =   "smtp.mail.yahoo.com"
  62.       Top             =   840
  63.       Width           =   4095
  64.    End
  65.    Begin VB.ComboBox cmbPOP 
  66.       BackColor       =   &H00FFC0C0&
  67.       Height          =   315
  68.       Left            =   1200
  69.       TabIndex        =   10
  70.       Text            =   "pop.mail.yahoo.com"
  71.       Top             =   480
  72.       Width           =   4095
  73.    End
  74.    Begin VB.TextBox txtPass 
  75.       BackColor       =   &H00FFC0C0&
  76.       Height          =   285
  77.       IMEMode         =   3  'DISABLE
  78.       Left            =   1200
  79.       PasswordChar    =   "*"
  80.       TabIndex        =   7
  81.       Top             =   1560
  82.       Width           =   1695
  83.    End
  84.    Begin VB.TextBox txtUsername 
  85.       BackColor       =   &H00FFC0C0&
  86.       Height          =   285
  87.       Left            =   1200
  88.       TabIndex        =   6
  89.       Top             =   1200
  90.       Width           =   1695
  91.    End
  92.    Begin VB.Label Label9 
  93.       Appearance      =   0  'Flat
  94.       BackColor       =   &H80000005&
  95.       BackStyle       =   0  'Transparent
  96.       Caption         =   "@"
  97.       ForeColor       =   &H0000FF00&
  98.       Height          =   255
  99.       Left            =   3000
  100.       TabIndex        =   16
  101.       Top             =   1200
  102.       Width           =   255
  103.    End
  104.    Begin VB.Label Label8 
  105.       Appearance      =   0  'Flat
  106.       BackColor       =   &H80000005&
  107.       BackStyle       =   0  'Transparent
  108.       Caption         =   "Save Password ?"
  109.       ForeColor       =   &H0000FF00&
  110.       Height          =   255
  111.       Left            =   3240
  112.       TabIndex        =   15
  113.       Top             =   1560
  114.       Width           =   1575
  115.    End
  116.    Begin VB.Label Label7 
  117.       Appearance      =   0  'Flat
  118.       BackColor       =   &H80000005&
  119.       BackStyle       =   0  'Transparent
  120.       Caption         =   "Username :"
  121.       ForeColor       =   &H0000FF00&
  122.       Height          =   255
  123.       Left            =   120
  124.       TabIndex        =   9
  125.       Top             =   1200
  126.       Width           =   735
  127.    End
  128.    Begin VB.Label Label6 
  129.       Appearance      =   0  'Flat
  130.       BackColor       =   &H80000005&
  131.       BackStyle       =   0  'Transparent
  132.       Caption         =   "Password"
  133.       ForeColor       =   &H0000FF00&
  134.       Height          =   255
  135.       Left            =   120
  136.       TabIndex        =   8
  137.       Top             =   1560
  138.       Width           =   735
  139.    End
  140.    Begin VB.Label Label5 
  141.       Appearance      =   0  'Flat
  142.       BackColor       =   &H80000005&
  143.       BackStyle       =   0  'Transparent
  144.       Caption         =   "SMTP Server"
  145.       ForeColor       =   &H0000FF00&
  146.       Height          =   255
  147.       Left            =   120
  148.       TabIndex        =   5
  149.       Top             =   840
  150.       Width           =   975
  151.    End
  152.    Begin VB.Label Label4 
  153.       Appearance      =   0  'Flat
  154.       BackColor       =   &H80000005&
  155.       BackStyle       =   0  'Transparent
  156.       Caption         =   "POP Server"
  157.       ForeColor       =   &H0000FF00&
  158.       Height          =   255
  159.       Left            =   120
  160.       TabIndex        =   4
  161.       Top             =   480
  162.       Width           =   975
  163.    End
  164.    Begin VB.Label cmdReset 
  165.       Alignment       =   2  'Center
  166.       Appearance      =   0  'Flat
  167.       BackColor       =   &H00FF8080&
  168.       BorderStyle     =   1  'Fixed Single
  169.       Caption         =   "Reset"
  170.       BeginProperty Font 
  171.          Name            =   "MS Serif"
  172.          Size            =   6
  173.          Charset         =   0
  174.          Weight          =   700
  175.          Underline       =   0   'False
  176.          Italic          =   0   'False
  177.          Strikethrough   =   0   'False
  178.       EndProperty
  179.       ForeColor       =   &H80000008&
  180.       Height          =   255
  181.       Left            =   3240
  182.       TabIndex        =   3
  183.       Top             =   4920
  184.       Width           =   855
  185.    End
  186.    Begin VB.Label cmdCancel 
  187.       Alignment       =   2  'Center
  188.       Appearance      =   0  'Flat
  189.       BackColor       =   &H00FF8080&
  190.       BorderStyle     =   1  'Fixed Single
  191.       Caption         =   "Cancel"
  192.       BeginProperty Font 
  193.          Name            =   "MS Serif"
  194.          Size            =   6
  195.          Charset         =   0
  196.          Weight          =   700
  197.          Underline       =   0   'False
  198.          Italic          =   0   'False
  199.          Strikethrough   =   0   'False
  200.       EndProperty
  201.       ForeColor       =   &H80000008&
  202.       Height          =   255
  203.       Left            =   2400
  204.       TabIndex        =   2
  205.       Top             =   4920
  206.       Width           =   855
  207.    End
  208.    Begin VB.Image imgClose 
  209.       Height          =   210
  210.       Left            =   5520
  211.       Picture         =   "frmEmailSetup.frx":02E2
  212.       Top             =   0
  213.       Width           =   225
  214.    End
  215.    Begin VB.Label Label3 
  216.       BackStyle       =   0  'Transparent
  217.       Caption         =   "Email CLient Setup"
  218.       BeginProperty Font 
  219.          Name            =   "MS Serif"
  220.          Size            =   6.75
  221.          Charset         =   0
  222.          Weight          =   400
  223.          Underline       =   0   'False
  224.          Italic          =   0   'False
  225.          Strikethrough   =   0   'False
  226.       EndProperty
  227.       ForeColor       =   &H00FFFF00&
  228.       Height          =   255
  229.       Left            =   840
  230.       TabIndex        =   1
  231.       Top             =   0
  232.       Width           =   1215
  233.    End
  234.    Begin VB.Label cmdOK 
  235.       Alignment       =   2  'Center
  236.       Appearance      =   0  'Flat
  237.       BackColor       =   &H00FF8080&
  238.       BorderStyle     =   1  'Fixed Single
  239.       Caption         =   "OK"
  240.       BeginProperty Font 
  241.          Name            =   "MS Serif"
  242.          Size            =   6
  243.          Charset         =   0
  244.          Weight          =   700
  245.          Underline       =   0   'False
  246.          Italic          =   0   'False
  247.          Strikethrough   =   0   'False
  248.       EndProperty
  249.       ForeColor       =   &H80000008&
  250.       Height          =   255
  251.       Left            =   1560
  252.       TabIndex        =   0
  253.       Top             =   4920
  254.       Width           =   855
  255.    End
  256.    Begin VB.Image Image1 
  257.       Height          =   5415
  258.       Left            =   -1200
  259.       Picture         =   "frmEmailSetup.frx":05C4
  260.       Stretch         =   -1  'True
  261.       Top             =   -120
  262.       Width           =   6975
  263.    End
  264. Attribute VB_Name = "frmEmailSetup"
  265. Attribute VB_GlobalNameSpace = False
  266. Attribute VB_Creatable = False
  267. Attribute VB_PredeclaredId = True
  268. Attribute VB_Exposed = False
  269. Option Explicit
  270. Dim AppPath As String
  271. Private Sub cmdAddPOP_Click()
  272. Dim I As Integer
  273. For I = 0 To cmbPOP.ListCount - 1
  274.  If cmbPOP.List(I) = cmbPOP.Text Then Exit Sub
  275. Next I
  276. cmbPOP.AddItem cmbPOP.Text
  277. '//// Put the code to save the server list here
  278. UpdateList AppPath & "POPserver.txt", cmbPOP.Text
  279. End Sub
  280. Private Sub cmdAddSMTP_Click()
  281. Dim I As Integer
  282. For I = 0 To cmbSMTP.ListCount - 1
  283.  If cmbSMTP.List(I) = cmbSMTP.Text Then Exit Sub
  284. Next I
  285. cmbSMTP.AddItem cmbSMTP.Text
  286. '//// Put the code to save the server list here
  287. UpdateList AppPath & "SMTPserver.txt", cmbSMTP.Text
  288. End Sub
  289. Private Sub cmdCancel_Click()
  290.  Unload Me
  291. End Sub
  292. Private Sub cmdOK_Click()
  293. POPAddress = Trim$(cmbPOP.Text)
  294. SMTPAddress = Trim$(cmbSMTP.Text)
  295. SMTPDomain = Trim$(txtDomain.Text)
  296. EmailUsername = Trim$(txtUsername.Text)
  297. EmailPass = Trim$(txtPass.Text)
  298. 'UPdate the lists
  299. cmdAddPOP_Click
  300. cmdAddSMTP_Click
  301. 'Clear the password field
  302. If chkSavePAssword.Value = 0 Then
  303.  txtPass.Text = ""
  304. End If
  305. Unload Me
  306. End Sub
  307. Private Function RetrieveList(strFilename As String, intRecordNumber As Integer) As String
  308. Dim Filenum As Integer
  309. Dim LineInFile As Integer
  310. Dim strBuffer As String
  311. LineInFile = 0
  312. 'Check the availability of file
  313.  If Dir(strFilename) = "" Then
  314.   RetrieveList = "Err"
  315.   Exit Function
  316.  End If
  317. Filenum = FreeFile 'Assign the file handle
  318. Open strFilename For Input As Filenum
  319.  Input #Filenum, strBuffer
  320.  LineInFile = LineInFile + 1
  321. Loop Until LineInFile = intRecordNumber
  322. 'Close the file
  323. Close Filenum
  324. RetrieveList = strBuffer
  325. End Function
  326. Private Function UpdateList(strFilename As String, strData As String) As Boolean
  327. Dim Filenum As Integer
  328. Dim FileOpened As Boolean
  329. On Error GoTo Erh:
  330. Filenum = FreeFile
  331. Open strFilename For Append As #Filenum
  332. FileOpened = True
  333. Write #Filenum, strData
  334. Close Filenum
  335. FileOpened = False
  336. On Error GoTo 0
  337. If FileOpened Then Close Filenum
  338. End Function
  339. Private Function CountList(strFilename As String) As Integer
  340. Dim I As Integer
  341. Dim Filenum As Integer
  342. Dim FileOpened As Boolean
  343. Dim strDummy As String
  344. 'Check the availability of file
  345.  If Dir(strFilename) = "" Then
  346.   CountList = 0
  347.   Exit Function
  348.  End If
  349. Filenum = FreeFile
  350. Open strFilename For Input As Filenum
  351. FileOpened = True
  352.  Input #Filenum, strDummy
  353.  I = I + 1
  354. Loop Until EOF(Filenum) = True
  355. Close Filenum
  356. FileOpened = False
  357. CountList = I
  358. If FileOpened Then Close Filenum
  359. End Function
  360. Private Sub cmdReset_Click()
  361.  Form_Load
  362. End Sub
  363. Private Sub Form_Load()
  364. Dim I As Integer
  365. Dim I2 As Integer
  366. Dim strPOP As String
  367. Dim strSMTP As String
  368. 'Set the application path
  369. AppPath = App.Path
  370. If Right$(AppPath, 1) <> "\" Then AppPath = AppPath & "\"
  371. If Dir(AppPath & "POPserver.txt") <> "" Then
  372.  'Update pop servers list
  373.  I = CountList(AppPath & "POPserver.txt")
  374.  For I2 = 1 To I
  375.   strPOP = RetrieveList(AppPath & "POPserver.txt", I2)
  376.   cmbPOP.AddItem strPOP
  377.  Next I2
  378. End If
  379. If Dir(AppPath & "SMTPserver.txt") <> "" Then
  380.  I = CountList(AppPath & "SMTPserver.txt")
  381.  For I2 = 1 To I
  382.   strSMTP = RetrieveList(AppPath & "SMTPserver.txt", I2)
  383.   cmbSMTP.AddItem strSMTP
  384.  Next I2
  385. End If
  386. End Sub
  387. Private Sub Label1_Click()
  388. End Sub
  389.